<script setup>
import { PlusDialog } from 'plus-pro-components'
import { getJob } from '@/api/monitor/job.js'
import { useCommonDict } from '@/views/monitor/job/hook.js'
const {   sys_job_group, sys_job_status } = useCommonDict()

const columns = [
  {
    label:"任务编号",
    prop:'jobId'
  },
  {
    label:"任务名称",
    prop:'jobName'
  },
  {
    label:"任务分组",
    prop: "jobGroup",
    valueType: "select",
    options: sys_job_group
  },

  {
    label:"cron表达式",
    prop:'cronExpression'
  },
  {
    label:"下次执行时间",
    prop:'nextValidTime'
  },
  {
    label:"下次执行时间",
    prop:'nextValidTime'
  },
  {
    label:"调用目标方法",
    prop:'invokeTarget'
  },
  {
    label:"任务状态",
    prop:'status',
    options: sys_job_status,
    valueType: 'select',
  },
  {
    label:"是否并发",
    prop:'concurrent',
    options: [
      {
        label: '允许',
        value: '0'
      },
      {
        label: '禁止',
        value: '1'
      }
    ],
    valueType: 'select',
  },
  {
    label:"执行策略",
    prop:'misfirePolicy',
    options: [
      {
        label: '立即执行',
        value: '1'
      },
      {
        label: '执行一次',
        value: '2'
      },
      {
        label: '放弃执行',
        value: '3'
      }
    ],
    valueType: 'select',
  },
]

const openView = ref(false)
const descriptionsData = ref({})

const open = (row)=>{
  getJob(row.jobId).then(response => {
    descriptionsData.value = response.data;
    openView.value = true;
  });
}

defineExpose({ open })
</script>

<template>
  <PlusDialog title="任务详细" v-model="openView" :has-footer="false"  close-on-click-modal width="700px" append-to-body>
    <PlusDescriptions :column="3" :columns="columns" :data="descriptionsData" />
  </PlusDialog>
</template>

<style scoped lang="scss">

</style>
